package com.maezia.tdr.common.enums;

import lombok.Getter;

import java.util.Arrays;
import java.util.Map;
import java.util.stream.Collectors;

@Getter
public enum ClientStatusEnum {
    OK(0,"正常"),LOCK(1,"锁定"),CANCEL(2,"禁用");

    private int code;
    private String message;
    private static Map<Integer,ClientStatusEnum> CLIENT_STATUS_ENUM_MAP;
    static {
        CLIENT_STATUS_ENUM_MAP = Arrays.stream(ClientStatusEnum.values()).collect(Collectors.toMap(
                ClientStatusEnum::getCode,ClientStatusEnum->ClientStatusEnum
        ));
    }


    ClientStatusEnum(int code, String message){
        this.code=code;
        this.message=message;
    }

    public static ClientStatusEnum getClientStatusEnum(Integer code){
        return CLIENT_STATUS_ENUM_MAP.get(code);
    }
}
